package fr.generali.accueilclient.gwt.client.ui.components.form.button;

import java.util.Iterator;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;

public class ButtonBar extends Composite implements HasWidgets {

    private final FlowPanel panel;

    public ButtonBar() {
        panel = new FlowPanel();
        initWidget(panel);
    }

    public ActionButton addActionButton(String text) {
        final ActionButton button = new ActionButton(text);
        panel.add(button);
        return button;
    }

    public CancelButton addCancelButton(String text) {
        final CancelButton button = new CancelButton(text);
        panel.add(button);
        return button;
    }

    public void addButton(Button button) {
        panel.add(button);
    }

    @Override
    public void setStyleName(String style) {
        panel.setStyleName(style);
    }

    @Override
    public void addStyleName(String style) {
        panel.addStyleName(style);
    }

    @Override
    public void add(Widget w) {
        panel.add(w);
    }

    @Override
    public void clear() {
        panel.clear();
    }

    @Override
    public Iterator<Widget> iterator() {
        return panel.iterator();
    }

    @Override
    public boolean remove(Widget w) {
        return panel.remove(w);
    }

}
